package com.blen.lib.ffmpeg;


import android.os.AsyncTask;

public class FFmpegTask extends AsyncTask<String[],Integer,Integer> {

    private Callback callback;

    public interface Callback{
        void onExecuted(int code);
    }

    public FFmpegTask(Callback callback){
        this.callback = callback;
    }

    @Override
    protected Integer doInBackground(String[]... strings) {
        try {
            return FFmpegUtils.run(strings[0]);
        }catch (Throwable e){
            e.printStackTrace();
            return 1;
        }
    }

    @Override
    protected void onPostExecute(Integer code) {
        if(callback!=null){
            callback.onExecuted(code);
        }
    }
}
